<template>
  <div id='main'>
  </div>
</template>

<script>
  import jsonp from 'jsonp'
  import echarts from 'echarts'
  import option from './yiqingBar_option.js'
  import  '../../assets/theme/chalk'
  export default {
    name: 'chart',
    data() {
      return {
        provinceList: [],
      }
    },
    mounted() {
      /* jsonp(url,回调函数); */
      jsonp('https://interface.sina.cn/news/wap/fymap2020_data.d.json', (error, responseData) => {
        console.log(responseData);
        this.provinceList = responseData.data.list;
        option.xAxis.data = this.provinceList.map(p=>p.name)
        option.series[0].data = this.provinceList.map(p=>p.econNum)
        echarts.init(this.$el).setOption(option);
      });//jsonp是异步执行
    }
  }
</script>

<style>
  #main{
    height: 100px;
    width: 100px;
  }
</style>
